<?php

namespace App\Http\Controllers;

use App\Exceptions\ApiException;
use App\Logic\MiGuLogic;
use Illuminate\Support\Facades\DB;

class RefreshMoney extends Base
{

    public function logic()
    {
        $object = DB::table('t_player_info')->where('id',$this->uid)->where('status',1)->first([
            'gold','diamonds','room_ticket'
        ]);
        if (empty($object)) {
            throw new ApiException('用户不存在');
        }
        $arr["uid"]      = $this->uid;
        $arr["gold"]     = $object->gold;
        $arr["diamonds"] = $object->diamonds;
        $arr["room_ticket"] = $object->room_ticket;
        $arr["quickly_grab_ticket"] = (int)DB::table('t_quickly_grab_ticket_info')->where('uid',$this->uid)->where('date',date('Y-m-d'))->value('count');
        return $this->returnData($arr);
    }

}